package com.yao.myioc.utils.support.impl;

import com.yao.myioc.utils.support.PrimitiveClassSupport;

import java.lang.reflect.Field;

/**
 * @author Henry Yao
 */
public class IntClassSupport implements PrimitiveClassSupport {

    @Override
    public boolean isSupport(Class<?> type) {
        return type == int.class;
    }

    @Override
    public void setProperty(Field field, Object instance, Object value) throws IllegalAccessException {
        field.setInt(instance, Integer.parseInt((String) value));
    }
}
